package com.zmn.oms.third.pinduoduo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 类描述：拼多多接口使用的常量类
 *
 * @author wangxiaokun
 * @since 2020/5/29 15:38
 */
@Component
public final class PinDuoDuoConsts {

    /* 订单功能标识 */
    public static final String FUN_NEW_ORDER = "new_order"; // 新单
    public static final String FUN_APPOINT_ORDER = "appoint_order"; // 订单预约通知
    public static final String FUN_CANCEL_ORDER = "cancel_order"; // 订单预约通知
    /* 店铺签约功能标识 */
    public static final String FUN_SIGN_SHOP = "sign_shop"; // 店铺签约

    public static final int PDD_CHANNEL_ID = 34165;

    /**
     * 拼多多渠道名称
     */
    public static final String CHANNEL_NAME = "上海寻梦信息技术有限公司-API";  // 别名：拼多多

    /**
     * 消息的功能标识（type）
     */
    public static final String PDD_SERVICE_AFTERSALES_SIGN_FLAG = "pdd.service.aftersales.sign";  // 服务签约接口
    public static final String PDD_SERVICE_AFTERSALES_SIGN_NOTIFY_FLAG = "pdd.service.aftersales.sign.notify";  // 签约结果回传
    public static final String PDD_SERVICE_AFTERSALES_ORDER_PUSH_FLAG = "pdd.service.aftersales.order.push";  // 服务端下发接口
    public static final String PDD_SERVICE_AFTERSALES_APPOINT_NOTY_FLAG = "pdd.service.aftersales.appoint.notify";  // 预约通知接口
    public static final String PDD_SERVICE_AFTERSALES_ORDER_CACEL_FLAG = "pdd.service.aftersales.order.cancel";  // 服务单取消接口
    public static final String PDD_SERVICE_SONSULT_TICKET_PUSH_FLAG = "pdd.service.sonsult.ticket.push";  // 投诉咨询订单下发接口
    public static final String PDD_SERVICE_SONSULT_TICKET_CANCEL_FLAG = "pdd.service.sonsult.ticket.cancel";  // 投诉咨询订单取消接口
    public static final String PDD_SERVICE_AFTERSALES_BIZACTION_NOTYFY_FALG = "pdd.service.aftersales.bizaction.notify";  //服务实操回告接口
    public static final String PDD_SERVICE_AFTERSALES_VERIFY_CHECK_FALG = "pdd.service.aftersales.verify.check";  // 核销码核销接口
    public static final String PDD_SERVICE_SONSULT_TICKET_NOTIFY_FLAG = "pdd.service.sonsult.ticket.notify";  // 咨询投诉工单处理回告接口

    /**
     * 平台发送给拼多多的消息状态码
     */
    public static final int ZMN_RETURN_CODE_SUCCESS = 0;    // 成功
    public static final int ZMN_RETURN_CODE_SERVER_ERROR = 2;   // 服务器内部错误
    public static final int ZMN_RETURN_CODE_PARAM_ERROR = 1001; // 参数错误
    public static final int ZMN_RETURN_CODE_REPEAT_ERROR = 1002; // 重复创建订单
    public static final int ZMN_RETURN_CODE_SIGN_SHOP_ERROR = 1003;  //申请店铺签约失败
    public static final int ZMN_RETURN_CODE_NOT_BALANCE_ERROR = 1004; // 厂商下单余额不足

    /**
     * 拼多多返回消息代码
     */
    public static final int PDD_RETURN_CODE_SUCCESS = 0;  // 成功
    public static final int ERROR_CODE_SEND_REQUEST_FAILED = 50003;  //发送消息失败
    public static final int ERROR_CODE_PARSE_MSG_FAILED = 50001;  // 解析消息内容失败
    public static final int ERROR_CODE_SERVER_UNKNOWN = 50000;  // 其他错误
    public static final int ERROR_CODE_PARAM_INVALID = 50002;   // 传入的参数错误

    /**
     * 拼多多接入总开关
     */
    public static boolean POWER_ON = true;

    /**
     * 拼多多接单类型
     */
    public static final String PDD_ACCEPT_ORDER = "accept";  // 接单
    public static final String PDD_ALLOCK_WORKER = "alloctWorker";  //分配师傅
    public static final String PDD_APPOINT_SERV = "appointServ";  //服务预约
    public static final String PDD_CHANGE_APPOINT = "changeAppoint";  //服务改约
    public static final String PDD_SIGN_SERV = "signServ";  //服务签到
    public static final String PDD_CHARGE_BACK = "chargeback";  //退单
    public static final String PDD_DONE_SERV = "doneServ";  //服务结单
    
    /**
     * 拼多多店铺签约状态
     */
    public static final String PDD_SIGN_ACCEPT = "accept";  // 通过
    public static final String PDD_SIGN_REJECT = "reject";  // 拒绝

    /**
     * 拼多多生产和测试路径
     */
//    public static String PDD_SERVICE_PATH = "https://gw-api-test.pinduoduo.com/ark/router"; // 测试
    public static String PDD_SERVICE_PATH = "https://ark-api.pinduoduo.com/ark/router"; // 正式
    
    /**
     * 拼多多开放平台公共参数
     */
//    public static String PDD_CLIENT_ID = "41a2e07ca24843c7a6de7c2b311ac5e2"; // 测试
    public static String PDD_CLIENT_ID = "b747d57823ef435ab92be461b6b67ed0"; // 正式
    public static String PDD_FORM_CLIENT_ID = "ccd2dc3ff241452ea74222f67d590b11";
//    public static String PDD_CLIENT_SECRET = "9b87fc9f2238269541b83b4fec68a6a64d057c03"; // 测试
    public static String PDD_CLIENT_SECRET = "01226ba8884c59e1f28647c9507be00b40fc8544"; // 正式
    public static String PDD_PARTNER_ID = "ZMN";
    public static String PDD_TARGET_CLIENT_ID = "ccd2dc3ff241452ea74222f67d590b11";
    
    @Value("${pinduoduo.service.powerOn:true}")
    public void setPowerOn(boolean powerOn) {
        POWER_ON = powerOn;
    }
    @Value("${pinduoduo.service.path:https://ark-api.pinduoduo.com/ark/router}")
    public void setPddServicePath(String pddServicePath) {
        PDD_SERVICE_PATH = pddServicePath;
    }
    @Value("${pinduoduo.service.clientId:b747d57823ef435ab92be461b6b67ed0}")
    public void setPddClientId(String pddClientId) {
        PDD_CLIENT_ID = pddClientId;
    }
    @Value("${pinduoduo.service.formClientId:ccd2dc3ff241452ea74222f67d590b11}")
    public void setPddFormClientId(String pddFormClientId) {
        PDD_FORM_CLIENT_ID = pddFormClientId;
    }
    @Value("${pinduoduo.service.clientSecret:01226ba8884c59e1f28647c9507be00b40fc8544}")
    public void setPddClientSecret(String pddClientSecret) {
        PDD_CLIENT_SECRET = pddClientSecret;
    }
    @Value("${pinduoduo.service.partnerId:ZMN}")
    public void setPddPartnerId(String pddPartnerId) {
        PDD_PARTNER_ID = pddPartnerId;
    }
    @Value("${pinduoduo.service.targetClientId:ccd2dc3ff241452ea74222f67d590b11}")
    public void setPddTargetClientId(String pddTargetClientId) {
        PDD_TARGET_CLIENT_ID = pddTargetClientId;
    }
}
